<?php
function http_link($text)
{
  return ereg_replace("[[:alpha:]]+://[^<>[:space:]]+",
                      "<a href=\"\\0\">\\0</a>", $text);
}

function esc($text)
{
  $uesc = array("&", "<", ">");
  $esc = array("&amp;", "&lt;", "&gt;");

  return str_replace($uesc, $esc, $text);
}

function unescape($text)
{
  $esc = array("\'", "\\\"", "\\\\");
  $uesc = array("'", "\"", "\\");
  return str_replace($esc, $uesc, $text);
}

?>